
<!--
/**************************************************
* @ viewdownloadresult.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/12, Simonyi Peng
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hitrust.gs.net.*"%>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>

<%
boolean isAllVictory = false;
boolean isOpenSoon = false;
boolean isManualAudit = false;
boolean isManualAuditAllowed = false;

String all_items_str = "";
String items_doing_str = "";
String items_refused_str = "";
String items_finished_str = "";
String items_canceled_str = "";

String all_items_btn = "";
String items_doing_btn = "";
String items_refused_btn = "";
String items_finished_btn = "";
String items_canceled_btn = "";

String all_items_action = "";
String items_doing_action = "";
String items_refused_action = "";
String items_finished_action = "";
String items_canceled_action = "";

String date = "";
int all_items = 0;
int items_doing = 0;
int items_refused = 0;
int items_finished = 0;
int items_canceled = 0;

GSAuditResultBean tBean = (GSAuditResultBean)request.getAttribute("auditresult");

if(tBean != null){
	date = tBean.getGs_audit_date();
	
	all_items = Integer.parseInt(tBean.getGs_audit_all_items());
	items_doing = Integer.parseInt(tBean.getGs_audit_items_doing());
	items_refused = Integer.parseInt(tBean.getGs_audit_items_refused());
	items_finished = Integer.parseInt(tBean.getGs_audit_items_finished());
	items_canceled = Integer.parseInt(tBean.getGs_audit_items_canceled());
	
	
	
	switch(all_items){
	case 0:all_items_str = "未对帐！";all_items_btn = "";break;
	case 1:all_items_str = "下载 订单明细对帐文件 成功！";break;
	case 2:all_items_str = "订单明细 对帐成功！";break;
	case 3:all_items_str = "下载 订单明细 对帐文件失败！";all_items_btn = "重新下载";all_items_action="doredownload(1)";break;
	case 4:all_items_str = "订单明细 对帐失败！";all_items_btn = "查看订单对帐不符明细";all_items_action="doview(1)";break;
	}
	switch(items_doing){
	case 0:items_doing_str = "未对帐！";all_items_btn = "";break;
	case 1:items_doing_str = "下载 送货确认对帐文件 成功！";break;
	case 2:items_doing_str = "送货确认 对帐成功！";break;
	case 3:items_doing_str = "下载 送货确认 对帐文件失败！";items_doing_btn = "重新下载";items_doing_action="doredownload(2)";break;
	case 4:items_doing_str = "送货确认 对帐失败！";items_doing_btn = "查看送货确认对帐不符明细";items_doing_action="doview(2)";break;
	}
	switch(items_refused){
	case 0:items_refused_str = "未对帐！";all_items_btn = "";break;
	case 1:items_refused_str = "下载 送货拒绝对帐文件 成功！";break;
	case 2:items_refused_str = "送货拒绝 对帐成功！";break;
	case 3:items_refused_str = "下载 送货拒绝 对帐文件失败！";items_refused_btn = "重新下载";items_refused_action="doredownload(3)";break;
	case 4:items_refused_str = "送货拒绝 对帐失败！";items_refused_btn = "查看送货拒绝对帐不符明细";items_refused_action="doview(3)";break;
	}
	switch(items_finished){
	case 0:items_finished_str = "未对帐！";all_items_btn = "";break;
	case 1:items_finished_str = "下载 交货确认对帐文件 成功！";break;
	case 2:items_finished_str = "交货确认 对帐成功！";break;
	case 3:items_finished_str = "下载 交货确认 对帐文件失败！";items_finished_btn = "重新下载";items_finished_action="doredownload(4)";break;
	case 4:items_finished_str = "交货确认 对帐失败！";items_finished_btn = "查看交货确认对帐不符明细";items_finished_action="doview(4)";break;
	}
	switch(items_canceled){
	case 0:items_canceled_str = "未对帐！";all_items_btn = "";break;
	case 1:items_canceled_str = "下载 送货取消对帐文件 成功！";break;
	case 2:items_canceled_str = "送货取消 对帐成功！";break;
	case 3:items_canceled_str = "下载 送货取消 对帐文件失败！";items_canceled_btn = "重新下载";items_canceled_action="doredownload(5)";break;
	case 4:items_canceled_str = "送货取消 对帐失败！";items_canceled_btn = "查看送货取消对帐不符明细";items_canceled_action="doview(5)";break;
	}
		
	//全是2，则当日所有文件对帐已成功
	if(all_items == 2 && items_doing == 2 && items_refused == 2 && items_finished == 2 && items_canceled == 2){
		isAllVictory = true;
	}
	//全是0，当日对帐尚未开始
	if(all_items == 0 && items_doing == 0 && items_refused == 0 && items_finished == 0 && items_canceled == 0){
		isOpenSoon = true;
	}
	//全是1，表示全部文件已经下载，可以开始手工对帐
	if(all_items == 1 && items_doing == 1 && items_refused == 1 && items_finished == 1 && items_canceled == 1){
		isManualAudit = true;
	}
	if(all_items >= 1 && items_doing >= 1 && items_refused >= 1 && items_finished >= 1 && items_canceled >= 1
		&& all_items != 3 && items_doing != 3 && items_refused != 3 && items_finished != 3 && items_canceled != 3
	){
		isManualAuditAllowed = true;
	}

}else{
	isOpenSoon = true;
}
%>


<html>
<head>
<title>对帐结果查询</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=response.encodeURL(request.getContextPath()+"/js/common.js")%>"></SCRIPT>
<script>


	function doManualAudit(){
		document.form1.action="<%= response.encodeURL(request.getContextPath() + "/A500105.do") %>";
		document.form1.submit();		
	}
	
	function doview(category){
		document.form1.action="<%= response.encodeURL(request.getContextPath() + "/A500103.do") %>?category=" + category;
		document.form1.submit();	
	
	}
	
	function doredownload(category){
		document.form1.action="<%= response.encodeURL(request.getContextPath() + "/A500104.do") %>?category=" + category;
		document.form1.submit();	
	}
	
</script>
</head>

<body BGCOLOR="#f2f2f2"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>

<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">查询对账结果</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>
<br>
<%
if(isOpenSoon){
%>
<!--显示对帐尚未开始表格-->
	<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=98% align=center border=0>
        <tr height=20> 
            <td align=middle class="bg_column"  >
            <div align="center" class="txt_content">对帐结果</div>
			</td>
		</tr>
		<TR height=20>
			<TD class="bg_row_odd" align=center>
				<br>					
				<p>系统尚未开始对帐...</p>
				<br>
			</TD>
		
		</TR>
	</table>
<!--显示对帐尚未开始表格-->
<%
}//end of open soon
else if(isAllVictory){
%>
<!--显示对帐成功表格-->
<br><br>
	<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=98% align=center border=0>
        <tr height=20> 
            <td align=middle class="bg_column"  >
            <div align="center" class="txt_content">对帐结果</div>
			</td>
		</tr>
		<TR height=20>
			<TD class="bg_row_odd" align=center>
			
			<p><%=date%>对帐成功</p>
			<br>
			<p>订单明细数量&nbsp;&nbsp;<%=tBean.getGs_audit_count1()%>&nbsp;&nbsp;笔</p>
			<br>
			<p>订单明细总金额&nbsp;&nbsp;<%=tBean.getGs_audit_total_price1()%>&nbsp;&nbsp;元</p>
			<br>
			<p>订货数量&nbsp;&nbsp;<%=tBean.getGs_audit_product_count1()%>&nbsp;&nbsp;笔</p>
			<br>
			<p>送货数量&nbsp;&nbsp;<%=tBean.getGs_audit_send_count1()%>&nbsp;&nbsp;笔</p>
			<br>
			<p>签收数量&nbsp;&nbsp;<%=tBean.getGs_audit_received_count1()%>&nbsp;&nbsp;笔</p>
			<br>
			<p>取消数量&nbsp;&nbsp;<%=tBean.getGs_audit_canceled_count1()%>&nbsp;&nbsp;笔</p>
			<br>
			
			</TD>
		</TR>
	</table>
<!--显示对帐成功表格-->
<%
}//end of all victory
else if(isManualAudit){
%>
<!--显示全部文件下载成功可以手工对帐表格-->
<br><br>
	<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=98% align=center border=0>
        <tr height=20> 
            <td align=middle class="bg_column"  >
            <div align="center" class="txt_content">对帐结果</div>
			</td>
		</tr>		
		<TR height=20>
			<TD class="bg_row_odd" align=center>
			<br>
			<p>所有对帐文件下载成功</p>
			<br>
			<p><input type=button name='manualaudit' value='开始手工对帐' onclick='doManualAudit();'></p>
			<br>

			
			</TD>
		</TR>
	</table>
<!--显示全部文件下载成功可以手工对帐表格-->
<%
}//end of manual audit
else{
%>

<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=98% align=center border=0>
        <tr height=20> 
            <td align=middle class="bg_column"  colspan=2>
            <div align="center" class="txt_content">对帐结果</div>
			</td>
		</tr>	

		<TR height=20 class='bg_row_even'>
			<TD align=center>
			<%=all_items_str%>
			</TD>
			<TD align=center>
			<a href="#" onclick="<%=all_items_action%>"><%=all_items_btn%></a>
			</TD>
		</TR>
		<TR height=20 class='bg_row_odd'>
			<TD align=center>
			<%=items_doing_str%>
			</TD>
			<TD align=center>
			<a href="#" onclick="<%=items_doing_action%>"><%=items_doing_btn%></a>
			</TD>
		</TR>
		<TR height=20 class='bg_row_even'>
			<TD align=center>
			<%=items_refused_str%>
			</TD>
			<TD align=center>
			<a href="#" onclick="<%=items_refused_action%>"><%=items_refused_btn%></a>
			</TD>
		</TR>
		<TR height=20 class='bg_row_odd'>
			<TD align=center>
			<%=items_finished_str%>
			</TD>
			<TD align=center>
			<a href="#" onclick="<%=items_finished_action%>"><%=items_finished_btn%></a>
			</TD>
		</TR>
		<TR height=20 class='bg_row_even'>
			<TD align=center>
			<%=items_canceled_str%>
			</TD>
			<TD align=center>
			<a href="#" onclick="<%=items_canceled_action%>"><%=items_canceled_btn%></a>
			</TD>
		</TR>
		<%if(isManualAuditAllowed){%>
		<TR height=20 class='bg_row_odd'>
			<TD align=center colspan=2>
				<input type=button name='manualaudit' value='重新开始手工对帐' onclick='doManualAudit();'>
			</TD>
		</TR>
		<%}%>
</table >
<%
}
%>
</center>
<form name="form1" id="form1" method="post" style="visibility: hidden;">
<input type='hidden' name='currentdate' value='<%=date%>'>
</form>
</body>
</html>